from django.db import models

from common.models import ObjectModel


class Product(ObjectModel):
    type = models.CharField(max_length=64, null=False)
    name = models.CharField(max_length=128, null=False)
    price = models.DecimalField(max_digits=10, decimal_places=2)

    class Meta:
        get_latest_by = 'update_at'
        db_table = 'product'

    def __str__(self):
        return '%s:%s' % (self.type, self.name)
